<?php

namespace app\dao\product\product;

use app\dao\BaseDao;
use app\model\product\product\StoreProductTemplate;

class StoreProductTemplateDao extends BaseDao
{
    protected function setModel(): string
    {
        return StoreProductTemplate::class;
    }

    public function getList(array $where, int $page = 0, int $limit = 0, string $order = '')
    {
        $query = $this->search($where, false)->order(($order ? $order . ' ,' : '') . 'id desc');
        if (isset($where['template_name']) && $where['template_name']) {
            $query->where('template_name', 'like', '%'. $where['template_name'] . '%');

        }
        return $query->paginate($where['limit'] ?? 15);
    }
}